Skip to main content

Redis Set up on centos 7

· 2 min read

Start by enabling the Remi repository by running the following commands in your SSH terminal:

Install the yum-utils package#

sudo yum install epel-release yum-utilssudo yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpmsudo yum-config-manager --enable remi

Install the Redis package#

sudo yum install redis

Once the installation is completed, start the Redis service and enable it to start automatically on boot with:

Start/Eanble Redis Service#

sudo systemctl start redissudo systemctl enable redis

Verify Redis Service#

sudo systemctl status redis

Configure Redis Remote Access#

By default, Redis doesn’t allow remote connections. You can connect to the Redis server only from 127.0.0.1 (localhost) - the machine where Redis is running. Perform the following steps only if you want to connect to your Redis server from remote hosts. If you are using a single server setup, where the application and Redis are running on the same machine then you should not enable remote access.

To configure Redis to accept remote connections open the Redis configuration file with your text editor:

sudo vim /etc/redis.conf

Locate the line that begins with bind 127.0.0.1 and add your server private IP address after 127.0.0.1 Make sure you replace 192.168.xxx.xxx with your IP address. Save the file and close the editor. 0.0.0.0 for public access and Restart the Redis service for changes to take effect:

sudo systemctl restart redis

Regards